package com.hub.utils.enums;

import lombok.Getter;

@Getter
public enum UserStatusEnum {
    CLOSED(0,"关闭"),
    Effective(1,"冻结"),
    WaitActivate(2,"待激活"),
    Freeze(3,"正常");

    private int code;
    private String description;

    UserStatusEnum(int code, String desc) {
        this.code = code;
        this.description = desc;
    }

    /**
     * 获取枚举值的描述
     * @param index
     * @return
     */
    public static String getDescription(int index) {
        for (UserStatusEnum c : UserStatusEnum.values()) {
            if (c.getCode() == index) {
                return c.description;
            }
        }
        return "未知编码";
    }
}
